package com.cloudkinto.service.order;

import com.baomidou.mybatisplus.extension.exceptions.ApiException;
import com.cloudkinto.common.web.PageResult;
import com.cloudkinto.common.web.SingleResult;
import com.cloudkinto.entity.OrderOutputPackageDetailDo;
import com.cloudkinto.service.order.vo.tiktok.OrderTiktokQueryBo;
import com.cloudkinto.service.order.vo.tiktok.OrderVO;
import com.cloudkinto.service.orderoutput.vo.OrderOutputAddReq;
import com.cloudkinto.service.user.vo.AuthResponse;
import org.springframework.stereotype.Service;
import tiktokshop.open.sdk_java.model.Authorization.V202309.GetAuthorizedShopsResponse;
import tiktokshop.open.sdk_java.model.Fulfillment.V202309.GetTrackingResponse;
import tiktokshop.open.sdk_java.model.Order.V202309.GetOrderDetailResponse;
import tiktokshop.open.sdk_java.model.Order.V202309.GetOrderListResponse;
import tiktokshop.open.sdk_java.model.Order.V202309.GetOrderListResponseDataOrders;
import tiktokshop.open.sdk_java.model.Product.V202502.SearchProductsResponse;

import java.io.IOException;
import java.util.List;
import java.util.Map;



public interface OrderTiktokService {

    String generateAuthUrl();

    SingleResult<AuthResponse> getAccessToken(String authCode);

    SingleResult<AuthResponse> refreshAccessToken(String refreshToken,Long shopId) throws IOException;

    //  SearchProductsResponse searchProducts(String accessToken, String shopCipher, String appKey, int pageNumber, int pageSize) throws ApiException;
    SearchProductsResponse searchProducts(Integer shopId, int pageNumber, int pageSize) throws ApiException;
    public void handleAndSyncOrders(List<GetOrderListResponseDataOrders> orders, Long shopId, Long companyId);

    GetAuthorizedShopsResponse authorizeShop(String accessToken) throws Exception;

    List<GetOrderListResponseDataOrders> getOrder(String accessToken, String shopCipher, Long shopId, String startDate, String endDate, Long companyId) throws Exception;

    List<Map> shopListFromPlantForm(Long companyId);

    PageResult getListPage(OrderTiktokQueryBo bo);

    OrderVO detail(String id);

    SingleResult sync(Long shopId, String startDate, String endDate, Long companyId) throws Exception;

    SingleResult markSendOut(List<String> req,Long userId);


    SingleResult sendOut(String[] ids, Long userId, Long companyId, boolean isAuto);

    SingleResult sendOutMatch(List<OrderOutputAddReq> orderOutputAddReqList, Long userId, boolean isAuto);

    String markPackageAsShipped(List<Map<String, List<OrderOutputPackageDetailDo>>> orderRequsts);

    String getShippingProviders(String deliveryOptionId, String accessToken, String shopCipher);

    GetTrackingResponse getTrackingInfo(String orderId);

    GetOrderDetailResponse detailOrder(String orderId);

    List<String> getOrderIds(List<Long> ids);

    void fixedTokenRefresh();
}
